package com.github.chirspan.xaas.gateway.interceptor;

import com.github.chirspan.xaas.core.constant.SecurityConstants;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.AllArgsConstructor;

/**
 * *******description*******
 * <p>
 * *************************
 *
 * @author chenpan
 * @date 2020/5/26 19:27
 */
@AllArgsConstructor
public class OAuthFeignRequestInterceptor implements RequestInterceptor {

    private String token;

    @Override
    public void apply(RequestTemplate template) {
        template.header(SecurityConstants.AUTHORIZATION, String.format("%s %s", SecurityConstants.BEARER, token));
    }
}
